Page({
  data: {
    detail: {},
  },
  // onLoad 获取页面参数，用于查询房屋详情
  onLoad(query) {
    // console.log('🟢 query', query)
    this.getDetail(query.id)
    this.id = query.id
  },
  // 获取房屋详情
  async getDetail(id) {
    const res = await wx.http.get(`/room/${id}`)
    this.setData({
      detail: res.data,
    })
  },
  editHouse() {
    wx.navigateTo({
      url: '/house_pkg/pages/form/index?id=' + this.id,
    })
  },
})
